import { Message } from 'element-ui'
import axios from '../../js/axios'
export default {
  namespaced: true,
  state: {},
  getters: {},
  mutations: {},
  actions: {
    // get方式
    async exportExcel ({ commit }, params) {
      try {
        let { data: { code, data, msg } } = await axios.get('/app/admin/download/download-l', { params: params })
        return new Promise((resolve, reject) => {
          if (code === 0) {
            resolve(data)
          } else {
            Message.error(msg)
            reject(data)
          }
        })
      } catch (err) {
        Message.error('服务器出错')
        console.log(err)
      }
    },
    // 获取提款申请列表
    async getDraw ({ commit }, params) {
      try {
        let { data: { code, data, msg } } = await axios.get('/app/admin/withdraw/get-withdraw-list-l', { params: params })
        return new Promise((resolve, reject) => {
          if (code === 0) {
            resolve(data)
          } else {
            Message.error(msg)
            reject(data)
          }
        })
      } catch (err) {
        Message.error('服务器出错')
        console.log(err)
      }
    },
    async updataDraw ({ commit }, params) {
      try {
        let { data: { code, data, msg } } = await axios.get('/app/admin/withdraw/dispose-withdraw-l', { params: params })
        return new Promise((resolve, reject) => {
          if (code === 0) {
            resolve(data)
          } else {
            Message.error(msg)
            reject(data)
          }
        })
      } catch (err) {
        Message.error('服务器出错')
        console.log(err)
      }
    }
  }
}
